package com.heima.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.github.pagehelper.Page;
import com.heima.pojo.Node;
import com.heima.pojo.User;
import com.heima.pojo.VmList;
import com.heima.pojo.dto.NodeDTO;
import com.heima.pojo.dto.NodePageQueryDTO;
import com.heima.pojo.vo.NodeVo;
import com.heima.pojo.vo.TypeVo;
import com.heima.pojo.vo.VmListVo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

@Mapper
public interface NodeMapper extends BaseMapper<Node> {

    Page<NodeVo> nodeQuery(NodePageQueryDTO dto);

    @Select("select * from tb_vending_machine where node_id = #{nodeId}")
    List<VmListVo> nodeFindById(Integer nodeId);

    @Select("select * from tb_vm_type")
    List<TypeVo> typeFindAll();

    @Select("select * from tb_node")
    List<NodeVo> nodeFindAll();


    @Select("select count(id) from tb_node")
    Integer nodeCount();
}
